import Mock from 'mockjs'
import { param2Obj } from '../utils/myUtils'
let List = []
for (var i = 0; i < 20; i++) {
    List.push({
        id: Mock.mock('@guid'),
        state: "待接诊",
        num: Mock.mock('@integer(100000,199999)'),
        name: Mock.mock('@cname'),
        sex: Mock.mock('@integer(0,1)'), //0:男1：女
        age: Mock.mock('@integer(1,100)'),
        phone: Mock.mock('@integer(10000000000, 19999999999)'),
        type: Mock.mock('@integer(2,3)'), //2:急诊 3：初诊
        office: Mock.mock('@integer(4,8)'), //4:全科 5：外科 6：内科 7：耳鼻喉科
        doctor: "王冕",
        date: Mock.mock('@now'),
    })
}

export default {
    managementMockData: (config) => {
        //分页逻辑
        let { page, pageSize } = param2Obj(config.url)
        let managementlist = List.filter((item, index) => {
            return (page - 1) * pageSize <= index && index < page * pageSize
        })
        return {
            code: 200,
            msg: '请求成功',
            data: managementlist,
            total: List.length
        }
    }

}